<!DOCTYPE html>
<html style="height: 100%">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    <script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</head>
<style>
    .table td{
        padding: 0.3rem;
    }
</style>
<body>
<table class="table">
    <tbody>
        <th:block th:each="prod : ${values}">
            <tr>
                <td th:each="entry : ${prod}">[[${entry.key.CODEStr}]]<span style="font-size: 10px;color: #cacaca;" th:text="'('+${entry.key.NAME}+' '+${entry.key.DATE}+' '+${entry.key.currentPrice}+' '+${entry.key.updownRate}+')'"></span></td>
                <td th:each="entry : ${prod}" th:text="${entry.key.staamountStr}"></td>
                <td th:each="entry : ${prod}" th:text="${#lists.size(entry.value)}"></td>
                <td th:each="entry : ${prod}" th:text="switch" style="cursor:pointer;" name="switch_btn" th:attr_code="${entry.key.CODEStr}"></td>
            </tr>
            <tr style="display: none;">
                <td colspan="4">
                    <textarea style="width: 100%;height: 300px;"></textarea>
                    <table class="table">
                        <tbody>
                            <th:block th:each="entry : ${prod}">
                                <tr th:each="value : ${entry.value}">
                                    <td style="font-size: 10px;color: #cacaca;" th:text="${value.NAME}"></td>
                                    <td th:text="${value.CODEStr}"></td>
                                    <td th:text="${value.DATE}"></td>
                                    <td th:text="${value.PRICE}"></td>
                                    <td style="font-size: 10px;color: #cacaca;" th:text="${value.TYPE}"></td>
                                    <td th:text="${value.amountStr}"></td>
                                </tr>
                            </th:block>
                        </tbody>
                    </table>
                </td>
            </tr>
        </th:block>
    </tbody>
</table>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script>
    $("td[name=switch_btn]").click(function () {
        var opttr = $(this).parent().next();
        var txtarea = opttr.find("textarea").eq(0);
        opttr.toggle();
        if(!txtarea.val()){
            $.get("/yidong/dadan",{"code":$(this).attr("attr_code")},function(msg){
                txtarea.val(msg);
            });
        }
    })
</script>
</body>
</html>